$(function(){
	$('.delete-list').on('click',function(){
		popup(this,"{:url('delete')}");
		
	});
	
	$('.startusing').on('click',function(){
		popup(this,"{:url('state')}");
	});
	$('.forbidden').on('click',function(){
		popup(this,"{:url('state')}");
	});
	$('.choose').on('click', function() {
		var index = parent.layer.getFrameIndex(window.name); 
		parent.$('.car_use').attr("value",$(this).data('name'));
		parent.$('.car_use_id').attr("value",$(this).data('id'));
		console.log(1)
		$.ajax({
			method:'POST',
			url:"{:url('used/department')}",
			data:{id:$(this).data('id')},
			success:function(res){
				console.log(res)
				var department;
				for (var d in res){
					department+=`<option value="${d}">${res[d]}</option>`
				}
				parent.$('.department').html(department)
				parent.layer.close(index);
			}
			
		})
		
//		
		
	});
	$('.department').on('click', function() {
		department("{:url('department/index',['op'=>'search'])}")
	});
	$('.passenger').on('click', function() {
		department("{:url('passenger/index',['op'=>'search','car_use_id'=>$item.car_use_id])}")
	});
	$('.order').on('click', function() {
		department("{:url('order/index',['op'=>'search'])}")
	});
})
